import { View, Image } from '@hips/taro-ui'
import { navigateTo } from '@tarojs/taro'
import Styles from './app-func.module.less'
import funcIcon from 'assets/icons/func-icon.png'
export default {
  name: 'AppFunc',
  props: {
    funcs: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    goPage(i) {
      console.log('跳转到对应页面', i.id)
      // navigateTo({
      //   url: `/pages/lowcode/${i.id}/index`
      // })
    }
  },
  render() {
    return (
      this.funcs.length && (
        <View class={Styles['app-funcs']}>
          {this.funcs.map(i => {
            return (
              <View
                class={Styles['app-funcs-item']}
                onTap={() => this.goPage(i)}
              >
                <Image
                  class={Styles['app-funcs-item-icon']}
                  src={i.funcUrl || funcIcon}
                ></Image>
                <View class={Styles['app-funcs-item-text']}>{i.name}</View>
              </View>
            )
          })}
        </View>
      )
    )
  }
}
